package com.sh.data.engine.domain.dataasset.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sh.data.engine.domain.base.model.PageResult;
import com.sh.data.engine.domain.dataasset.model.domain.DataAssetDomain;
import com.sh.data.engine.domain.dataasset.model.param.SaveNewTblPropParam;
import com.sh.data.engine.repository.dao.dataasset.entity.TblPropEntity;

import java.util.Collection;
import java.util.List;

/**
 * @Author: zigui.zdf @Date: 2022/1/11 11:02:08 @Description:
 */
public interface TblPropService extends IService<TblPropEntity> {

    TblPropEntity getTblPropByTblId(Long projectId, Long tblId);

    List<TblPropEntity> findByTblpropId(Collection<Long> themeId);

    List<TblPropEntity> getTblPropByThemeId(Long themeId);

    List<TblPropEntity> getTblPropByThemeIdList(List<Long> themeIdList);

    TblPropEntity getTblPropByTblName(Long projectId, String schema, String tblName);

    TblPropEntity getTblPropByTblName(Long projectId, String tblName);

    TblPropEntity getTblPropBySchemaTblName(Long projectId, String schema, String tblName);

    PageResult<TblPropEntity> getTblPropPage(
        Long projectId,
        Integer pageNum,
        Integer pageSize,
        List<Long> themeIds,
        List<String> tableNames,
        String search,
        String orderField,
        String order);

    TblPropEntity saveNewTblPropEntity(SaveNewTblPropParam saveNewTblPropParam);

    List<TblPropEntity> getTblPropListByIdList(Long projectId, List<Long> idList);

    List<TblPropEntity> getTblPropListByTblNameList(Long projectId, List<String> tblNameList);

    TblPropEntity getTblPropById(Long id);

    List<TblPropEntity> getTblPropByProjectId(Long projectId);

    List<TblPropEntity> getAllTblPropByProjectId(Long projectId);

    DataAssetDomain getDataAssetCount(Long projectId);

    boolean updateTblPropById(TblPropEntity entity);

    void updateBatch(List<TblPropEntity> entities);

    void insertBatch(List<TblPropEntity> entities);

    String getSecretLevel(String tableName, Long projectId);

    /**
     * 生成tblid
     *
     * @return
     */
    Long generateTblId(Long projectId);

    List<TblPropEntity> getMatrixTblProp(Long projectId, Long themeId, String type);

    List<TblPropEntity> getCdmQuotaSourceTable(Long projectId, Long themeId, String type);

    void deleteTbl(Long projectId, Long tblId);

    List<TblPropEntity> getListByPage(Long projectId, Integer pageSize, Integer pageNum);

//    boolean checkSecretLevel(String table, Long projectId, Long userId);
    boolean checkSecretLevel(String table, Long projectId, String userId);

//    void createTableSecret(List<String> tables, Long projectId, Long userId);
    void createTableSecret(List<String> tables, Long projectId, String userId);
}
